// 引入进度条插件
import 'nprogress/nprogress.css'
import NProgress from 'nprogress'
import { createRouter, createWebHistory } from 'vue-router'

import routes from './routes'

NProgress.configure({
  showSpinner: false,
})

const router = createRouter({
  routes,
  history: createWebHistory(),
})

router.beforeEach((to, from, next) => {
  NProgress.start()
  next()
})

router.afterEach(() => {
  NProgress.done()
})

export default router
